package com.xuetang9.t9.hotel.services.impl;

import com.xuetang9.t9.hotel.beans.EFoodcategory;
import com.xuetang9.t9.hotel.mapper.GoryMapper;
import com.xuetang9.t9.hotel.services.IGoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName GoryService
 * @Description TODO
 * @Author qin
 * @Date 2020/2/24 17:07
 * @Version 1.0
 **/
@Service
public class GoryService implements IGoryService {
    @Autowired
    private GoryMapper goryMapper;

    @Override
    public List<EFoodcategory> goryList() {
        return goryMapper.queryGoryList();
    }

    @Override
    public boolean insertGory(EFoodcategory eFoodcategory) {
        return goryMapper.insertGory(eFoodcategory.getId(),eFoodcategory.getName(),eFoodcategory.getFoodCount())>0;
    }

    @Override
    public boolean deleteGory(int id) {
        return goryMapper.deleteGory(id)>0;
    }

    @Override
    public boolean updateGory(EFoodcategory eFoodcategory) {
        return goryMapper.updateGory(eFoodcategory.getName(),eFoodcategory.getFoodCount(),eFoodcategory.getId())>0;
    }

    @Override
    public int goryCount() {
        return goryMapper.queryGoryCount();
    }

    @Override
    public List<EFoodcategory> queryByAll() {
        return goryMapper.selectByFood();
    }

    @Override
    public List<String> queryGoryName() {
        return goryMapper.queryGoryName();
    }

    @Override
    public List<Integer> queryGoryOrder() {
        return goryMapper.queryGoryOrder();
    }
}
